<?php
/**
 * 
 * 관심역 model
 * @author gudals
 *
 */

class modelContUserInterestStation extends modelContBase
{
    /**
     * 
     * 관심역 등록
     * @param array $aReq 등록정보
     * @return boolean
     */
    public function insert($aReq)
    {
        if (empty($aReq)) return false;
        
        $sQuery = "
            insert into user_interest_station (
                user_no,
                station_no,
                regist_dt
            ) values (
                '".$aReq['user_no']."',
                '".$aReq['station_no']."',
                now()
            )
        ";
        
        $this->executeQuery($sQuery, 'exec');
        return $this->lastInsertID();
    }
    
    /**
     * 
     * 관심역 리스트
     * @param int $iUserNo 회원코드
     * @return boolean|Ambigous <NULL, multitype:void , void, unknown>
     */
    public function getStation($iUserNo)
    {
        if (empty($iUserNo)) return false;
        
        $sQuery = "
            select
                t1.station_no,
                t2.station,
                t2.city_no,
                t2.city,
                t2.line_no,
                t2.line
            from
                user_interest_station as t1,
                subway_info as t2
            where
                t1.user_no = '".$iUserNo."'
            and
                t1.station_no = t2.station_no
        ";
        
        return $this->executeQuery($sQuery, 'rows');
    }
}